home *** CD-ROM | disk | FTP | other *** search
/ Cracking 2 / Cracking II..iso / Texty / crackme / LVL1TUT.TXT < prev    next >
Encoding:
Text File  |  1999-07-23  |  6.4 KB  |  134 lines

  1.  
  2.                solution for CrackMe Level 1 By noos@nettaxi.com      
  3.                           solved By Nuno1 on 22 july 1999              
  4.                 any comments can be sent to nuno_2@hotmail.com       
  5.                ------------------------------------------------
  6.  
  7. Information :
  8.     Cracker    : Nuno1 
  9.     Date       : 22 july 1999
  10.     Level      : 2-3
  11.     Protection : Key for a code.
  12.  
  13.     Tools used :
  14.       - SoftIce
  15.       - Borland C for Combination finder
  16.  
  17. Hey Crackers !
  18.  
  19. this is a pretty easy crackme to understand the idea. but you have to understand it.
  20.  
  21. -- Information --
  22.  
  23. ok the crackme show us a CODE and wait for us to fill the KEY , when pressing ok it check
  24. the key if its the right key or not.
  25.  
  26. ----------------------------- CRACKING THE PROGRAM --------------------------
  27.  
  28. ok , let start with bpx on hmemcpy to get in when he cut our key.
  29.  
  30. press some F12 until you will see this :
  31.  
  32. :00401456 E8F9020000              Call 00401754
  33. :0040145B 8B442410                mov eax, dword ptr [esp+10] <- here is your key
  34. :0040145F 8D542418                lea edx, dword ptr [esp+18]
  35. :00401463 52                      push edx
  36. :00401464 6848304000              push 00403048              
  37. :00401469 50                      push eax                   
  38. :0040146A FF1584214000            Call dword ptr [00402184]  <- scanf (make your key numeric)
  39. :00401470 8B4C2424                mov ecx, dword ptr [esp+24] <- our number return in ecx
  40. :00401474 51                      push ecx
  41. :00401475 FF15B0214000            Call dword ptr [004021B0] <-srand function
  42. :0040147B 8B3DB8214000            mov edi, dword ptr [004021B8]
  43. :00401481 83C410                  add esp, 00000010
  44. :00401484 BE0C000000              mov esi, 0000000C
  45. :00401489 FFD7                    call edi  <- rand function
  46.  
  47. ok so we in the right place .. as you can see he calls the srand and rand function
  48. if you dont know srand is a function that start a randomize number . 
  49. what does it mean ? it means that if you want a random number you can call rand function
  50. but it will allways be the same randomize numbers. srand start the randomize with a asked
  51. number.. mostly everyone send the time to it , because it allways not the same.
  52.  
  53. so you can see that srand gets our key and if you will get in , you will see it also
  54. start the randomize number with the given number.
  55.  
  56. then there is a call to rand to get a randomize number .. but its really not a randomize
  57. number for us now .. we can learn the rand function and to know witch number will return
  58. allways.
  59.  
  60. i allready done your job and write it in the C program that came with my tutorial.
  61. so lets continue :
  62.  
  63. :00401484 BE0C000000              mov esi, 0000000C  <- esi = 0xC (12d)
  64. :00401489 FFD7                    call edi  <- rand function
  65.  
  66. :0040148B 99                      cdq
  67. :0040148C B91A000000              mov ecx, 0000001A               
  68. :00401491 F7F9                    idiv ecx              <-divide the number we got from rand
  69.                                                         <-with 1Ah
  70.                                                         <-so it means that eax = result
  71.                                                         <-and edx = modular
  72.                                                         <-edx will allways be a number between
  73.                                                         <-0 to 1Ah
  74.  
  75. :00401493 8D4C240C                lea ecx, dword ptr [esp+0C] 
  76. :00401497 8A541424                mov dl, byte ptr [esp+edx+24]  <-taking somthing from esp+edx+24 ??
  77. :0040149B 52                      push edx                       <-push the taking byte
  78. :0040149C E8AD020000              Call 0040174E                  <-??
  79. :004014A1 4E                      dec esi                        
  80. :004014A2 75E5                    jne 00401489                   jmp when esi-1 (12 times)
  81.  
  82. ok so we can see this is a loop on the rand number . he gets the number divide with 1A
  83. take the modular and take it from esp+24+modular.
  84.  
  85. ok , bpx on the line of 401497 and do d esp+24 .. what do u see ??? :) a table :
  86. 'ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  87. there are 26 letters right ? if we hex it it will be 1A .. so he choose a RANDOM letter
  88. each time , the "??" call you can see above is a call to add the letter to a new string.
  89.  
  90. for us is not a random number (it is but .. :) ) because we can get the same result with 
  91. a program that we will write .. but lets continue :
  92.  
  93. :004014A4 8B442414                mov eax, dword ptr [esp+14]    <- the CODE !!
  94. :004014A8 8B4C240C                mov ecx, dword ptr [esp+0C]    <- your new KEY !!
  95. :004014AC 50                      push eax         
  96. :004014AD 51                      push ecx
  97. :004014AE FF15BC214000            Call dword ptr [004021BC]      <- comapare !!
  98. :004014B4 83C408                  add esp, 00000008
  99. :004014B7 85C0                    test eax, eax        
  100. :004014B9 7512                    jne 004014CD                  <-is is not ok ?
  101. :004014BB 50                      push eax                      <-if yes stay here
  102. :004014BC 683C314000              push 0040313C
  103. :004014C1 682C304000              push 0040302C  <- the string "Thank you for registering!"
  104. :004014C6 8BCD                    mov ecx, ebp
  105.  
  106. so we found the algo of this one .. its srand your serial number and start to get rand each 
  107. time for a new char.
  108. well you may understand that to reverse it is imposible (maybe its not for me).
  109.  
  110. so we have to write a combination finder for this program.
  111.  
  112. all we have to do is to srand(number) , take the rand number mod with 1Ah and get the char
  113. for it until we pass 0c times (there are 12 letters for the code and he also run 0Ch times)
  114. and check if the code is ok .. if not .. number+1 ;) and so on ..
  115.  
  116. well , i wrote my example (as allways) in C for you to understand it more . but it
  117. can be writen in assembler and get much better results. even that it takes only 8 min to find.
  118.  
  119. even so !! the key to this crackme is : 692659380
  120.  
  121. you can understand by that .. that the person that right the crackme is also dont have a clue
  122. whats going on there .. he just call rand and srand to make the job .. for him to get the
  123. CODE of is own , he just write a program that will do the same as we do , he type a number
  124. and make the rand , srand make the job and took the CODE for it and hardcoded it in the
  125. program.
  126.  
  127. well thats it for this crackme ..
  128.  
  129. hope you learn somthing new ;)
  130.  
  131. Nuno1 - Nuno_2@hotmail.com
  132.  
  133.  
  134.